package com.whosly.mysql.protocol.constant;

import io.netty.util.AttributeKey;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.nio.charset.Charset;

/**
 * Common constants for protocol.
 *
 * @author fengyang(yueny09 @ 163.com)
 * @date 2023年06月29日 下午7:37
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class CommonConstants {

    public static final AttributeKey<Charset> CHARSET_ATTRIBUTE_KEY = AttributeKey.valueOf(Charset.class.getName());

    public static final AttributeKey<String> ALLOW_MULTI_QUERIES_ATTRIBUTE_KEY =
            AttributeKey.valueOf("allowMultiQueries");

    public static final String UNSUPPORT = "N/U";
    public static final String NULL = "N/A";

    /**
     * 默认定时监控更新间隔, 单位毫秒
     */
    public static final long DEFAULT_SCHEDULE_MONITOR_PERIOD_MS = 5 * 1000;

    /**
     * 默认定时监控更新线程个数
     */
    public static final int DEFAULT_SCHEDULE_MONITOR_THREAD_SIZE = 3;

    /**
     * 默认系统用户ID
     */
    public static final Long DEFAULT_USER_ID_FOR_SYS = 100001L;

    /**
     * 不存在的dbId
     */
    public static final Long ERROR_DATABASE_ID = 0L;

    /**
     * 未登录，鉴权的用户ID
     */
    public static final Long DEFAULT_USER_ID = 100001L;

    /**
     * PID info 标志位：创建
     */
    public static final String PID_INFO_STATE_CREATE = "create";

    /**
     * PID info 标志位：结束
     */
    public static final String PID_INFO_STATE_FINISH = "finish";

    /**
     * PID info 标志位：异步任务
     */
    public static final String PID_INFO_STATE_ASYNC = "async";

    public static final String QUOTE = "`";

}
